<%--
  Created by IntelliJ IDEA.
  User: ZJM
  Date: 2024/4/21
  Time: 17:31
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
  <title>Title</title>
</head>
<body>
<%
  pageContext.setAttribute("key1", "pageContext");
  request.setAttribute("key1", "request");
  session.setAttribute("key1", "session");
  application.setAttribute("key1", "application");
  //使用技巧
  pageContext.setAttribute("req",request);
%>
${key1}
<%--选择性的输入某个域中的数据--%>
${requestScope.key1}<br>

<%--pageContext对象的使用--%>
<ul>
  <li>协议：${req.scheme}</li>
  <li>服务器 IP：${pageContext.request.serverName}</li>
  <li>服务器端口：${pageContext.request.serverPort}</li>
  <li>工程路径：${pageContext.request.contextPath}</li>
  <li>请求方法：${pageContext.request.method}</li>
  <li>客户端 IP：${pageContext.request.remoteAddr}</li>
  <li>会话的 ID 编号：${pageContext.session.id}</li>
</ul>

<%--获取请求参数--%>
<%--http://localhost:8080/el/EL04.jsp?username=zjm--%>
<ul>
  <li>请求参数的集合:${param}</li>
  <li>请求参数的值的数组:${paramValues}</li>
</ul>


<%--HTTP 请求头的集合--%>
<ul>
  <li>${header}</li>
  <li>${header['accept-language']}</li>
  <li>${headerValues}</li>
</ul>

<%--cookie--%>
<div>${cookie}</div>

<%--initParam--%>
<div>${initParam}</div>

</body>
</html>
